#ifndef MAIN_WINDOW_HPP
#define MAIN_WINDOW_HPP

#include <QAction>
#include <QLabel>
#include <QMainWindow>
#include <QMenuBar>
#include <QStatusBar>
#include <QString>
#include <QTabWidget>

//project includes
#include "include/widgets/stock_info_widget.hpp"
#include "include/widgets/trading_widget.hpp"
#include "include/widgets/portfolio_widget.hpp"
#include "include/widgets/report_widget.hpp"
#include "include/widgets/login_dialog.hpp"

class MainWindow : public QMainWindow {
  Q_OBJECT

public:
  explicit MainWindow(QWidget *parent = nullptr);
  ~MainWindow();

private slots:
  void onLogin();
  void onLogout();
  void onUserLoggedIn(const QString &username);
  void onUserLoggedOut();
  void onStockSelected(const QString &stockCode, const QString &stockName,
                       double price);
  void updateStatusBar();

private:
  void setupUI();
  void setupMenuBar();
  void setupStatusBar();
  void setupConnections();

private:
  TradingSystem *m_tradingSystem;

  QTabWidget *m_tabWidget;
  StockInfoWidget *m_stockInfoWidget;
  TradingWidget *m_tradingWidget;
  PortfolioWidget *m_portfolioWidget;
  ReportWidget *m_reportWidget;

  QAction *m_loginAction;
  QAction *m_logoutAction;

  QLabel *m_statusLabel;
  QLabel *m_timeLabel;
};

#endif // MAIN_WINDOW_HPP
